package com.atguigu.test.config;

import com.atguigu.test.po.Man;
import org.springframework.context.annotation.ImportSelector;
import org.springframework.core.io.support.SpringFactoriesLoader;
import org.springframework.core.type.AnnotationMetadata;

import java.sql.Array;
import java.util.List;

/**
 * @author zp
 * @version 1.0
 * @description: 自定义扫描类 注入扫描SpringFactories文件的类 实现自动装配
 * @date 2023/2/6 19:42
 */
public class MyConfigurationImportSelector implements ImportSelector {
    @Override
    public String[] selectImports(AnnotationMetadata importingClassMetadata) {
        List<String> names = SpringFactoriesLoader.loadFactoryNames(Man.class, null);
        return names.toArray(new String[0]);
    }
}
